module PcrWebApps
  module HttpCredentials
    def self.included(base)
      base.extend ClassMethods
      base.send(:include, InstanceMethods)
    end

    module ClassMethods
    end
    module InstanceMethods
private
      def authenticate
        unless RAILS_ENV == 'test'
          authenticate_or_request_with_http_basic do |app_name, password|
            app_name == CREDENTIALS["app_name"] && password == CREDENTIALS["password"]
          end
        end
      end
    end
  end
end
